import groovy.json.JsonBuilder

def x =["om#tat", "tat#sat" , "sat#om", "xx#y" ]

def tasks = [1, 2, 3]
def json = new JsonBuilder()

json{  
	success (true)
  data( x.collect {
	  def a = it.split("#")
	  [source: a[0]] +
		  [target: a[1]] +
		  [type: "type"]		  
})
}
  
println json.toPrettyString()
